home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CURSOR.SWG / 0009_Cursor Stuff in ASM.pas < prev    next >
Pascal/Delphi Source File  |  1993-06-08  |  2KB  |  90 lines

  1. (*
  2. ===========================================================================
  3.  BBS: Canada Remote Systems
  4. Date: 05-28-93 (05:36)             Number: 8641
  5. From: LOU DUCHEZ                   Refer#: NONE
  6.   To: KURT TAN                      Recvd: NO
  7. Subj: CURSOR CONTROL                 Conf: (58) PASCAL
  8. ---------------------------------------------------------------------------
  9. KT>Can someone tell me how to make the cursor in Turbo Pascal disappear and
  10. KT>appear?
  11.  
  12. Whah, sher, li'l pardner.  There is *no* function to turn off the cursor
  13. per se in Pascal or among the BIOS interrupts.  However, you can change
  14. the appearance of the cursor, making it span 0 pixels (as opposed to the
  15. usual 2).  And to this purpose, I've included some of my favorite cursor
  16. routines, stored in a prize Unit of mine.
  17.  
  18. To define a cursor, you need to store the format in a word.  The standard
  19. cursor for, say, CGA is $8786 (I think); the "6" and "7" say that the
  20. cursor starts at pixel 7 and ends at pixel 6.  The eights mean that there
  21. are eight pixels to be messing with -- honestly that's a guess, I've
  22. never seen it in a book anywhere.  For VGA and Hercules, I'm pretty sure
  23. you have 15 pixels to work with; the normal cursor there is something like
  24. $fefc (something like that -- I'm working off CGA, so it's hard for me to
  25. test that theory).  In either case, no matter the graphics system, a good
  26. way to turn off the cursor is to set it to $ffff.
  27. *)
  28.  
  29. procedure cursoff;
  30. const ffff: word = $ffff;
  31.  
  32. { Turns the cursor off.  Stores its format for later redisplaying. }
  33.  
  34. begin
  35.   asm
  36.     mov ah, 03h
  37.     mov bh, 00h
  38.     int 10h
  39.     mov crstyp, cx   { global variable -- for later retrieval }
  40.     mov ah, 01h
  41.     mov cx, ffff
  42.     int 10h
  43.     end;
  44.   end;
  45.  
  46.  
  47. procedure curson;
  48.  
  49. { Turns the cursor back on, using the cursor display previously stored. }
  50.  
  51. begin
  52.   asm
  53.     mov ah, 01h
  54.     mov cx, crstyp   { previously-stored cursor format }
  55.     int 10h
  56.     end;
  57.   end;
  58.  
  59.  
  60. function getcursor: word;
  61.  
  62. { Returns the cursor format. }
  63.  
  64. var tempword: word;
  65. begin
  66.   asm
  67.     mov ah, 03h
  68.     mov bh, 00h
  69.     int 10h
  70.     mov tempword,cx
  71.     end;
  72.   getcursor := tempword;
  73.   end;
  74.  
  75.  
  76. procedure setcursor(curstype: word);
  77.  
  78. { Sets the cursor format. }
  79.  
  80. var tempword: word;
  81. begin
  82.   tempword := curstype;
  83.   asm
  84.     mov ah, 01h
  85.     mov cx,tempword
  86.     int 10h
  87.     end;
  88.   end;
  89.  
  90.